package com.mes.check.dao;

import org.springframework.stereotype.Repository;

import com.mes.check.dao.iface.IReworkDao;
import com.mes.check.domain.Rework;
import com.mes.common.dao.BasicDao;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
import org.hibernate.Session;

@Repository
public class ReworkDao extends BasicDao<Rework> implements IReworkDao {

	private static final Log log = LogFactory.getLog(ReworkDao.class);

	@Override
	public List<Rework> getReworksByDefectJudgeUid(String defectJudgeUid) {
		List list = null;
		try {
			Session session = this.getSession();
			StringBuilder hql = new StringBuilder();
			hql.append("from " + this.getClass().getName() + " where ");
			hql.append(" defectJudgeUid=?");
			Query query = session.createQuery(hql.toString());
			query.setString(0, defectJudgeUid);

			list = query.list();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

}
